<?php
/**
 * AccountAgentTradeLogInfoView
 *
 * @package Akimimi front
 * @author by M.Wang
 */

require_once '../app/views/BaseView.php';

class AccountAgentTradeLogInfoView extends BaseView {

    public $log;

    public function getPage(){
        $arr_navsetting = array(
            array('url'=>'/userinfo/index', 'text'=>MYAKIMIMITXT),
            array('text'=>constant( 'ATT' . $this->log['trade_type'] . 'DETAILTXT' ))
        );
        $this->setPageTitle(constant( 'ATT' . $this->log['trade_type'] . 'DETAILTXT' ));
        $this->addCSS('tradelog.css');
        $this->addCSS('myaccountleftnav.css');
        $this->addJS('frontend.js',true);
        $str_js = "
        <script type='text/javascript'>
            function paymentSupplement(int_id){
                $('#paymentOrderId').val(int_id);
                Supplement.openPaymentDialog();
                $('#paymentSupplementForm').submit();
            }
        </script>
        ";
        $this->setHeadExtends($str_js);
        $header = '';
        require_once '../app/views/MyAccoutLeftNavView.php';
        $myAccountLeftNavView = new MyAccountLeftNav();
        $str_result = $header
                    . $this->getNavigation($arr_navsetting)
                    . "<div id='mymimi_body'>"
                    . $myAccountLeftNavView->getMyAccountLeftNav()
                    . $this->getContent()
                    . '</div>'
                    . "
        <div id='paymentDialog' style='left:0px;top:0px;background-color:#000;display:none;position:absolute;z-index:9;text-align:center;font-size:12px;filter:alpha(opacity=50);-moz-opacity:0.5;' onclick='try{event.cancelBubble = true;}catch(e){event.stopPropagation();}'>
            <div id='paymentDialogContent' style='position:static;height:120px;width:320px;background-color:#fff;border:1px solid #000;font-size:16px;'>
                <div style='background-color:#690;line-height:24px;height:24px;;font-size:1em;text-align:left;'>
                    <span style='margin-left:5px;font-weight:700;color:#fff;'>在线支付提示</span>
                </div>
                <div style='margin-top:10px;height:48px;font-size:12px;line-height:24px;'>
                    <span>请您在新打开的网上银行页面上完成付款</span><br/>
                    <span>付款完成前请<b>不要关闭</b>此窗口</span>
                </div>
                <div style='height:48px;padding:5px;'>
                    <input type='button' value='已完成付款'  onclick='window.location.reload();'/>
                    <input type='button' value='付款遇到问题' onclick='window.location.reload()';'/>
                </div>
            </div>
        </div><form id='paymentSupplementForm' method='post' action='/o/supplyment' target='_blank'><input type='hidden' id='paymentOrderId' name='id' /></form>";

        return $this->getHtmlPage($str_result);
    }

    public function getContent(){
        $str_result = "<div id='mymimi_right'><div class='right_bj'></div>";
        $str_result.= "<div id='coupons_list'>";
        $str_result.= "<div id='coupons_nav'><ul><li class='title_1'>" . constant( 'ATT' . $this->log['trade_type'] . 'DETAILTXT' ) . "</li><li class='title_2' style='float:right;width:400px;text-align:right;margin-right:2px;'>" . AATLSNNTXT . $this->log['sn'] . "</li></ul></div>";
        $str_result.= "<div class='coupons_border'>";

        $str_result.= "<div class='coupons_row' style='border-bottom:1px solid #f2f2f2;'><ul>";
        $str_result.= "<li class='style_1' style='border:none;width:100px;text-align:left;margin-left:10px;'>" . constant( 'ATT' . $this->log['trade_type'] . 'NUMBERTXT' ) . '</li>';
        $str_result.= "<li class='style_1' style='border:none;width:260px;text-align:left;'>" . $this->log['trade_num'] . '</li>';
        $str_result.= "<li class='style_1' style='border:none;width:100px;text-align:left;margin-left:10px;'>" . constant( 'ATT' . $this->log['trade_type'] . 'COSTTYPETXT' ) . '</li>';
        $str_result.= "<li class='style_1' style='border:none;width:260px;text-align:left;'>" . ( $this->log['trade_type'] > 1 ? AgentAccount::getAgentAccountWithdrawType( $this->log['withdraw_type'] ) : AgentAccount::getAgentAccountSupplementType( $this->log['supplement_type'] ) ) . '</li>';
        $str_result.= "</ul></div>";

        $str_result.= "<div class='coupons_row' style='border-bottom:1px solid #f2f2f2;'><ul>";
        $str_result.= "<li class='style_1' style='border:none;width:100px;text-align:left;margin-left:10px;'>" . constant( 'ATT' . $this->log['trade_type'] . 'ACCOUNTTXT' ) . '</li>';
        $str_result.= "<li class='style_1' style='border:none;width:260px;text-align:left;'>" . $this->log['email'] . '</li>';
        $str_result.= "<li class='style_1' style='border:none;width:100px;text-align:left;margin-left:10px;'>" . constant( 'ATT' . $this->log['trade_type'] . 'COSTTXT' ) . '</li>';
        $str_result.= "<li class='style_1' style='border:none;width:260px;text-align:left;'>" . MONEYTAG . $this->log['trade_sum'] . '</li>';
        $str_result.= "</ul></div>";

        $str_result.= "<div class='coupons_row' style='border-bottom:1px solid #f2f2f2;'><ul>";
        $str_result.= "<li class='style_1' style='border:none;width:100px;text-align:left;margin-left:10px;'>" . constant( 'ATT' . $this->log['trade_type'] . 'STATUSTXT' ) . '</li>';
        $str_result.= "<li class='style_1' style='border:none;width:260px;text-align:left;'>" . AgentAccount::getAgentAccountTradeLogStatus($this->log['status']) . '</li>';
        $str_result.= "<li class='style_1' style='border:none;width:100px;text-align:left;margin-left:10px;'>" . constant( 'ATT' . $this->log['trade_type'] . 'PAYTIMETXT' ) . '</li>';
        $str_result.= "<li class='style_1' style='border:none;width:260px;text-align:left;'>" . ( $this->log['trade_type'] > 1 ? $this->log['created'] : $this->log['out_date'] ) . '</li>';
        $str_result.= "</ul></div>";

        $str_result.= "<div class='coupons_row' style='border-bottom:1px solid #f2f2f2;'><ul>";
        $str_result.= "<li class='style_1' style='border:none;width:100px;text-align:left;margin-left:10px;'>" . constant( 'ATT' . $this->log['trade_type'] . 'PAYTYPETXT' ) . '</li>';
        $str_result.= "<li class='style_1' style='border:none;width:260px;text-align:left;'>" . ($this->log['about_type']<1 ? constant( 'ATT' . $this->log['trade_type'] . 'COSTTYPEVALUE0' ):($this->log['about_type']<2 ? constant( 'ATT' . $this->log['trade_type'] . 'COSTTYPEVALUE1' ) : constant( 'ATT' . $this->log['trade_type'] . 'COSTTYPEVALUE2' ))) . '</li>';
        $str_result.= "<li class='style_1' style='border:none;width:100px;text-align:left;margin-left:10px;'>" . constant( 'ATT' . $this->log['trade_type'] . 'MONEYTXT' ) . '</li>';
        $str_result.= "<li class='style_1' style='border:none;width:260px;text-align:left;'>" . MONEYTAG . $this->log['balance_now'] . '</li>';
        $str_result.= "</ul></div>";

		if (intval( $this->log['about_type'], 10 ) === 1 && $this->log['status'] == '2') {
            $str_result.= "<div class='coupons_row' style='border-bottom:1px solid #f2f2f2;height:24px;'><ul>";
            $str_result.= "<li class='style_1' style='border:none;width:100%;'><input type='button' value='" . AATLPAYBTN . "' onclick='paymentSupplement({$this->log['account_agent_trade_log_id']});' /></li>";
            $str_result.= "</ul></div>";
        }

        if ($this->log['trade_type'] > 1) {
            $str_result.= "<div class='coupons_row' style='border-bottom:1px solid #f2f2f2;'><ul>";
            $str_result.= "<li class='style_1' style='border:none;width:100px;text-align:left;margin-left:10px;'>" . constant( 'ATT' . $this->log['trade_type'] . 'MIMITIMETXT' ) . '</li>';
            $str_result.= "<li class='style_1' style='border:none;width:460px;text-align:left;'>" . $this->log['in_date'] . '</li>';
            $str_result.= "</ul></div>";
        }

        if ($this->log['about_type'] > 1) {
            $str_result.= "<div class='coupons_row' style='border-bottom:1px solid #f2f2f2;'><ul>";
            $str_result.= "<li class='style_1' style='border:none;width:100px;text-align:left;margin-left:10px;'>" . constant( 'ATT' . $this->log['trade_type'] . 'COSTBANKTXT' ) . '</li>';
            $str_result.= "<li class='style_1' style='border:none;width:260px;text-align:left;'>" .  ($this->log['trade_type'] > 1 ? $this->log['in_bank_name'] : $this->log['out_bank_name']) . '</li>';
            $str_result.= "<li class='style_1' style='border:none;width:100px;text-align:left;margin-left:10px;'>" . constant( 'ATT' . $this->log['trade_type'] . 'COSTACCOUNTTXT' ) . '</li>';
            $str_result.= "<li class='style_1' style='border:none;width:260px;text-align:left;'>" . ($this->log['trade_type'] > 1 ? $this->log['in_id'] : $this->log['out_id']) . '</li>';
            $str_result.= "</ul></div>";

            $str_result.= "<div class='coupons_row' style='border-bottom:1px solid #f2f2f2;'><ul>";
            $str_result.= "<li class='style_1' style='border:none;width:100px;text-align:left;margin-left:10px;'>" . constant( 'ATT' . $this->log['trade_type'] . 'COSTUSERNAMETXT' ) . '</li>';
            $str_result.= "<li class='style_1' style='border:none;width:260px;text-align:left;'>" . ( $this->log['trade_type'] > 1 ? $this->log['in_name'] : $this->log['out_name'] ) . '</li>';
            if (!$this->log['trade_type'] > 1) {
                $str_result.= "<li class='style_1' style='border:none;width:100px;text-align:left;margin-left:10px;'>" . constant( 'ATT' . $this->log['trade_type'] . 'RECIVEACCTOUNTTXT' ) . '</li>';
                $str_result.= "<li class='style_1' style='border:none;width:260px;text-align:left;'>" . $this->log['in_id'] . '</li>';
            }
            $str_result.= "</ul></div>";
        }

        $str_result.= '</div></div></div>';
        return $str_result;
    }

}

?>
